﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class LoginPanel : BasePanel
{

    protected override void Awake()
    {
        //一定不能少父类Awake，因为需要执行父类的Awake()来进行初初始化一些信息，比如找控件，添加事件监听
        base.Awake();
    }
    // Start is called before the first frame update
    void Start()
    {
        //GetComp<Button>("ButtonStart").onClick.AddListener(ClickStart);
        //GetComp<Button>("ButtonQuit").onClick.AddListener(ClickQuit);


        UIMgr.AddCostomEventListener(GetComp<Button>("ButtonStart"), EventTriggerType.PointerEnter, (data) =>
        {
            Debug.Log("鼠标进入");
        });
        UIMgr.AddCostomEventListener(GetComp<Button>("ButtonStart"), EventTriggerType.PointerExit, (data) =>
        {
            Debug.Log("鼠标离开");
        });
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    protected override void OnClick(string btnName)
    {
        switch (btnName)
        {
            case "ButtonStart":
                Debug.Log("ButtonStart被点击");
                break;
            case "ButtonQuit":
                Debug.Log("ButtonQuit被点击");
                break;
        }

    }

    public override void ShowMe()
    {
        base.ShowMe();
        InitPanel();
    }

    private void InitPanel()
    {
        Debug.Log("init");
    }

    private void ClickStart()
    {
        Debug.Log("Start");
    }

    private void ClickQuit()
    {
        Debug.Log("Quit");
    }
}
